/**
 * Copyright 2023 the original brandnewdata.com.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * https://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.zlb.envmodify;

import com.zlb.envmodify.transform.DynamicEnvModify;

import java.lang.instrument.Instrumentation;
import java.lang.reflect.InvocationTargetException;

/**
 * @Description Agent探针入口类
 * @ClassName EnvModifyAgent
 * @Author:zhulb
 * @Date 2023/03/23
 * @Version 0.0.1
 * @see [https://blog.csdn.net/yangyanping20108/article/details/134562187]
 */
public class EnvModifyAgent {

    /**
     * jvm 参数形式启动，运行此方法
     *
     * @param agentArgs
     * @param inst
     */
    public static void premain(String agentArgs, Instrumentation inst) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException {
        DynamicEnvModify.modify(agentArgs,inst);
    }

    /**
     * 动态 attach 方式启动，运行此方法
     * 暂不考虑此方式
     *
     * @param agentArgs
     * @param inst
     */
    public static void agentmain(String agentArgs, Instrumentation inst) {
//        inst.addTransformer(new ClassTransformer());
//        DynamicEnvModify.modify();
    }


}
